package cn.jetpiece.cloud.dict.api;

import cn.jetpiece.cloud.dict.api.model.params.CreateDictItemParam;
import cn.jetpiece.cloud.dict.api.model.params.UpdateDictItemParam;
import cn.jetpiece.cloud.dict.api.model.query.DictItemQuery;
import cn.jetpiece.cloud.dict.api.model.result.DictItemResult;
import cn.jetpiece.cloud.model.page.PageResult;
import cn.jetpiece.cloud.model.response.Result;
import cn.jetpiece.cloud.resource.annotation.annotation.ApiResource;
import cn.jetpiece.cloud.resource.annotation.annotation.ScanResource;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * @author hancp
 * @version 1.0
 * @description: 字典明细
 * @date 2021/12/6 11:20
 */
@Api(tags = "字典明细")
@ApiResource
public interface DictItemApi {

    String SERVER_API = "/${jetpiece.common.path:common}";

    String API = "/dicts/items";

    /**
     * 查询字典明细数据
     *
     * @param sysDictItemQuery
     * @return
     */
    @ApiOperation(value = "字典明细分页列表", notes = "字典明细分页列表")
    @ScanResource(path = {SERVER_API + API, API}, method = RequestMethod.GET)
    Result<PageResult<DictItemResult>> queryPageList(DictItemQuery sysDictItemQuery);

    /**
     * 新增
     *
     * @param sysDictItemParam
     * @return
     */
    @ApiOperation(value = "新增", notes = "新增")
    @ScanResource(path = {SERVER_API + API, API}, method = RequestMethod.POST)
    Result<DictItemResult> add(@RequestBody CreateDictItemParam sysDictItemParam);

    /**
     * 编辑
     *
     * @param sysDictItemParam
     * @return
     */
    @ApiOperation(value = "编辑", notes = "编辑")
    @ScanResource(path = {SERVER_API + API, API}, method = RequestMethod.PUT)
    Result<DictItemResult> edit(@RequestBody UpdateDictItemParam sysDictItemParam);

    /**
     * 删除字典数据
     *
     * @param ids
     * @return
     */
    @ApiOperation(value = "删除字典数据", notes = "删除字典数据")
    @ScanResource(path = {SERVER_API + API + "/{ids}", API + "/{ids}"}, method = RequestMethod.DELETE)
    Result<DictItemResult> delete(@PathVariable(name = "ids") String ids);

    /**
     * 字典值重复校验
     *
     * @param sysDictItem
     * @return
     */
    @ApiOperation(value = "字典重复校验接口", notes = "字典重复校验接口")
    @ScanResource(path = {SERVER_API + API + "/check-dict-item", API + "/check-dict-item"}, method = RequestMethod.GET)
    Result<String> doDictItemCheck(DictItemQuery sysDictItem);
}
